﻿namespace EFMLEditor
{
    using System;
    using System.Windows.Forms;

    public partial class Property : UserControl
    {
        public void Init(string name, Type t, object o, object value)
        {
            this.label1.Text = name;
            if (t.IsEnum)
            {
                var cb = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList };
                cb.Items.AddRange(o as object[]);
                cb.SelectedItem = value;
                this.panel1.Controls.Add(cb);

                this.panel1.Dock = DockStyle.Right;
                this.panel1.AutoSize = true;
                cb.AutoSize = true;
            }
        }

        public Property()
        {
            this.InitializeComponent();
        }
    }
}